﻿using System;
using System.Collections.Generic;
using System.Text;
using MongoDB.Bson;

namespace TrackTool
{
    class LocItem
    {
        public ObjectId _id;
        public string device_id { get; set; }
        public DateTime date { get; set; }
        public double lat { get; set; }
        public double lng { get; set; }
        public DateTime time { get; set; }
        public int lac;
        public int ci;
        public int mnc;
        public int state;
        public int c_t;
        public int b_r;
        public int cell_count;
        public string cell_list;
    }



    class LAC_CID : System.Object
    {
	    public int mnc;
	    public UInt32 lac;
	    public UInt32 cid;

	    public override bool Equals(System.Object obj)
	    {
            LAC_CID p = obj as LAC_CID;
            if ((object)p == null)
            {
                return false;
            }
		    return (lac == p.lac && cid == p.cid && mnc == p.mnc);
	    }

	    public bool Equals(LAC_CID value)
	    {
		    return (lac == value.lac && cid == value.cid && mnc == value.mnc);
	    }

        public override int GetHashCode()
        {
            return (int)(mnc ^ lac ^ cid);
        }
    }


    class BASIC_LOC_ITEM
    {
	    public double lat;
	    public double lng;
	    public DateTime tTime;
        public DateTime tEndTime;
	    public LAC_CID cid;
	    public List<LAC_CID> cidlist;
	    public int weight;
	    public bool publicNode;
	    public int radius;

	    public bool isSafeRegion()
        {
		    bool ret = false;
		    if(cid.cid == 0 && cidlist.Count > 0 && tEndTime != null)
			    ret = true;
		    return ret;
	    }
    }

    class ItemSafeRoute 
    {
	    public BASIC_LOC_ITEM spt;
	    public BASIC_LOC_ITEM ept;
        public List<BASIC_LOC_ITEM> list;
	    public int mergeCount;

	    public ItemSafeRoute()
	    {
		    mergeCount = 1;
	    }
    }
}
